#include <stdio.h>


int main(){
	int T;
	int i, j, n, tmp;
	int prev_max, prev_index;
	int max, begin, end;
	scanf("%d", &T);
	for(j=0; j < T; j++){
		max = prev_max = -2000;
		begin = end = prev_index = 0;
		scanf("%d", &n);
		for(i=0; i < n; i++){
			scanf("%d", &tmp);
			if(prev_max >= 0){
				prev_max = prev_max + tmp;
			}else{
				prev_max = tmp;
				prev_index = i;
			}
			if(max < prev_max){
				max = prev_max;
				begin = prev_index;
				end = i;
			}
		}
		printf("Case %d:\n", j + 1);
		printf("%d %d %d\n", max, begin + 1, end + 1);
		if(j != T-1){
			putchar('\n');
		}

	}
	return 0;
}
